/*
 * @Author: QinJiu
 * @Date: 2022-07-20 10:29:24
 * @LastEditors: Qinjiu
 * @LastEditTime: 2022-07-20 15:29:01
 * @Description:
 */

import _ from "lodash";

// 获取默认状态数据
const getDefaultState = () => {
  return {
    sidebar: {
      opened: true, // 侧边栏是否展开
    },
  };
};

// 初始状态数据
const state = getDefaultState();

const mutations = {
  /**
   * 切换sidebar状态
   */
  TOGGLE_SIDEBAR: (state) => {
    state.sidebar.opened = !state.sidebar.opened;
  },
};

const actions = {
  /**
   * 切换sidebar状态
   */
  toggleSideBar({ commit }) {
    commit("TOGGLE_SIDEBAR");
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
